import request from '~/common/request'

export const state = () => ({
  logs: {}
});

export const actions = {
  async getLogs ({commit, state}, params) {
    let data = await request.get('/sys/log/list', {params: params});
    data && commit('setLogs', data);
  }
};

export const mutations = {
  setLogs(state, data) {
    data.page.loading = false;
    state.logs = data.page;
  },
  resetLoading(state, key) {
    state[key].loading = true;
  }
};
